﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Lesson06SessionApi.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class DemoController : ControllerBase
    {
        [HttpGet]
        public ActionResult SetValues()
        {
            this.HttpContext.Session.SetString("Session1", "Value1");
            return new ContentResult() { Content = "Value1" };
        }

        [HttpGet]
        public IActionResult GetValues()
        {
            var valueSession = this.HttpContext.Session.GetString("Session1");
            return new ContentResult() { Content = valueSession };
        }
    }
}
